home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 21
/
Cream of the Crop 21 (Terry Blount) (October 1996).iso
/
program
/
oxcc1434.zip
/
SRC
/
CFF.H
< prev
next >
Wrap
C/C++ Source or Header
|
1995-11-26
|
25KB
|
815 lines
/* CFF.H -- user api include file for the cff library */
#define CALLER(a) (((unsigned*)&a)[-1])
#if defined(__GNUC__) || defined(__OXCC__)
#ifndef __ITEMH__
#define __ITEMH__
typedef unsigned long long KeyItem; /* type for a key's associated item */
#endif
#endif
typedef union /* 2 BYTES */
{
unsigned short val;
unsigned char b[2];
} SVAL;
typedef union /* 4 BYTES */
{
unsigned long a0;
void *a1;
struct
{
SVAL lo_word;
SVAL hi_word;
} a2;
struct
{
unsigned int pad :28;
unsigned int type :4;
} a3;
struct
{
unsigned char b[4];
} a4;
int a8;
short a9;
char a10;
float a11;
} ADDR;
#ifndef __STORH__
#define __STORH__
typedef union _stor /* 8 BYTES */
{
unsigned long a0;
void *a1;
#if defined(__GNUC__) || defined(__OXCC__)
KeyItem item;
#endif
struct
{
unsigned short lo_word;
unsigned short hi_word;
unsigned int size :28; /* in bytes or nibbles */
unsigned int type :4; /* describes the STOR type */
} a2;
struct
{
short s0;
short s1;
short s2;
short s3;
} a3;
struct
{
unsigned long s0;
unsigned long s1;
} a4;
struct
{
unsigned char b[8];
} a5;
#if defined(__GNUC__) || defined(__OXCC__)
struct
{
unsigned long long dupname :48;
unsigned long long dupid :16;
} a6;
#endif
struct
{
unsigned int home : 30;
unsigned int full : 2;
} a7;
int a8;
short a9;
char a10;
float a11;
double a12;
} STOR, Item;
#endif /* __STORH__ */
/* DEFINITIONS FOR "a2.type */
#define STO_INACTIVE (0)
#define STO_NIL (1)
#define STO_VALUE (2)
#define STO_CHUNK (3)
#define STO_KEYINFO (4)
#define STO_NILCHUNK (5)
#define STO_COMPCHUNK (6)
#define STO_ALLOCATED (7)
#define STO_DELETED (8) /* always ored with non zero */
#define STOMASK (7)
typedef struct {
unsigned long name;
unsigned short xname;
unsigned short id;
} DupName;
typedef struct /* 12 BYTES */
{
STOR c0;
ADDR c1;
} CAT;
#define CATEXACT (8)
#define CATHASH (cat.c1.a0)
typedef struct /* 20 bytes */
{
STOR stor;
CAT cat;
} SDB;
/* DEFINE CFF OPEN MODES */
#define F_RDONLY (0x0001)
#define F_WRONLY (0x0002)
#define F_RDWR (0x0003)
#define F_CREAT (0x0004)
#define F_TEMP (0x0008)
#define F_UNIQ (0x0010)
#define F_EXCL (0x0020)
#define F_BITMAP (0x0040)
#define F_TRUNC (0x0080)
#define F_APPEND (0x0100)
#define F_DELETING (0x0200)
#define F_FILEONLY (0x0400)
#define F_BIGDIR (0x0800)
#define F_HUGEDIR (0x1000)
#define F_SETUP (0x4000)
#define F_PARENTS (0x4000)
#define F_SORTED (0x8000)
#define F_UNTAGGED (0x10000)
#define F_STAT (0x20000) /* TRULY READONLY */
#define F_TEXT (0x40000) /* DOS crap, default mode is binary */
#define F_ZIPFILE (0x80000) /* compress the file aspect */
#define F_ZIPDATA (0x100000) /* compress data chunks */
#define F_TEMPFILE (F_RDWR|F_CREAT|F_UNIQ|F_TEMP)
/* BUFFER RELEASE MODES */
#define R_DIRTY (0x80000000)
#define R_CLEAN (0x40000000)
#define R_FLUSH (0x20000000)
/* DEFINE SOME SYSTEM CALL VALUES */
#define S_READBLK (1)
#define S_WRITEBLK (2)
#define S_GETSPACE (3)
#define S_GIVESPACE (4)
#define S_CLOSE (5)
#define S_OPEN (6)
#define S_CREATE (7)
#define S_UNLINK (8)
#define S_SEEK (9)
#define S_FLUSH (10)
#define S_CLOSETRUNC (11)
#define S_SET (0)
#define S_CUR (1)
#define S_END (2)
/* DEFINE CFF OBJECT PROPERTIES -- returned by cfobtype(void *something) */
#define OB_SHARE (0x00000001)
#define OB_ISDIR (0x00000002)
#define OB_BMOK (0x00000004)
#define OB_SMOK (0x00000008)
#define OB_MEM (0x00000010)
#define OB_RAWDEV (0x00000020)
#define OB_CFILE (0x00000040)
#define OB_SETUP (0x00000080)
#define OB_FOD (0x00000100)
#define OB_ROOTDIR (0x00000200)
#define OB_DIRTY (0x00000400)
#define OB_DELCLOSE (0x00000800)
#define OB_WRITE (0x00001000)
#define OB_BITMAP (0x00002000)
#define OB_XFILE (0x00004000)
#define OB_ISNEW (0x00008000)
#define OB_SMEM (0x00010000)
#define OB_FILEONLY (0x40000000)
#define OB_HASHDIR (0x20000000)
#define OB_TREEDIR (0x10000000)
#define OB_UNTAGGED (0x08000000)
#define OB_PREALLOC (0x01000000)
#define OB_ZIPFILE (0x00800000)
#define OB_ZIPDATA (0x00400000)
#define OB_CHUNK (0x00200000)
#define OB_VALUE (0x00100000)
#ifndef NULL
#define NULL ((void *)0)
#endif
#ifndef EOF
#define EOF (-1)
#endif
#define YES (1)
#define NO (0)
#define OK (1)
#define NODUPS (0)
#define OKDUPS (1)
#define CNTDUPS (2)
#define DUPNAMES (4)
#define PREALLOC1 (8)
#define PREALLOC2 (16)
#define PREALLOC3 (32)
#define ERROR (-1)
#define FOUND (1)
#define NOTFOUND (0)
#define NONE (-1) /* no value */
#define INVALID (-4) /* invalid value */
#define LESS (-1) /* a is less than b */
#define EQUAL (0) /* a and b are equal */
#define GREATER (2) /* a is greater than b */
#define BOI (-2) /* beginning of index */
#define EOI (-3) /* end of index */
typedef struct opninfo {
long initial_entries;
unsigned long bitmap_prealloc;
long data_prealloc;
} OPNINFO;
typedef struct cfdirent {
int d_namlen;
char *d_name;
unsigned long d_bytesalloc;
unsigned long d_bytesused;
unsigned long d_mode;
unsigned long d_entrycnt;
unsigned long d_ino;
unsigned long d_mtime;
unsigned long d_ctime;
void *d_fpt;
} CFDIRENT;
/* Function codes for the cfmisc instruction */
enum CfMisc {
CF_ALLOC,CF_USED,CF_DEPTH,CF_MARK,CF_HEAD,CF_TAIL,CF_NEXT,
CF_PREV,CF_KEYLEN,CF_DATALEN,CF_MODBUFS,
CF_CURBUFS,CF_SETKEYCMP,CF_SETITEMCMP,CF_SETERRFUNC,
CF_LAZY,CF_VERYLAZY,CF_CLRLAZY,CF_ISNEW,CF_FLUSH,
CF_FILESIZE,CF_FILEALLOC,CF_PREALLOC,CF_ALIGNMENT,
CF_MAPSIZE,CF_ISSORTED,CF_KEY,CF_ITEM,CF_CREEP,
CF_SETPRINTFUNC,CF_DATA,CF_GETMARK,CF_SETMARK
};
typedef struct cffstat {
unsigned long st_smhead;
unsigned long st_smtail;
unsigned short st_id;
unsigned short st_keysize;
STOR st_dups;
unsigned long st_bmhead;
unsigned long st_bmtail;
unsigned long st_mode;
short st_uid;
short st_gid;
long st_mtime;
long st_ctime;
unsigned long st_highleaf;
unsigned long st_size;
unsigned long st_alloc;
unsigned long st_entrycnt;
short st_mapsize;
unsigned short st_dupids;
long st_atime;
long st_filesize;
long st_filealloc;
long st_obtype;
unsigned int st_filedups;
long st_ino;
short st_blksize;
short st_dev;
short st_nlink;
short st_rdev;
} CFSTAT;
/* MODE BITS */
#define M_AFMT (0x30000000)
#define M_ROOTDIR (0x80000000)
#define M_FILEONLY (0x40000000)
#define M_HASHDIR (0x20000000)
#define M_TREEDIR (0x10000000)
#define M_UNTAGGED (0x08000000)
#define M_BITMAP (0x04000000)
#define M_EXTRNFILE (0x02000000)
#define M_PREALLOC (0x01000000)
#define M_ZIPFILE (0x00800000)
#define M_ZIPDATA (0x00400000)
#define M_CHUNK (0x00200000)
#define M_VALUE (0x00100000)
#define M_IFMT (0x0000F000)
#define M_IFREG (0x00008000)
#define M_IFDIR (0x00004000)
#define M_IFIFO (0x00002000)
#define M_IFCHR (0x00001000)
#define M_IFBLK (0x00003000)
#define M_IREAD (0x00000100)
#define M_IWRITE (0x00000080)
#define M_IEXEC (0x00000040)
extern void *PERMCAT;
extern void *PERMINFO;
extern void *PERMFILE;
extern void *MEMTEMP;
#define MEMTMP MEMTEMP
extern char *cff_version;
extern char *cff_copyright;
#ifdef __cplusplus
extern "C" {
#endif
/* STDIO STUFF */
#define __BUFSIZ_ 4096
extern struct cf_iobuf {
int _cnt;
char* _ptr;
char* _base;
int _bufsiz;
short _flag;
unsigned char _file;
char _sbuf;
} cf_iob[];
extern void *cf_filelist[];
typedef struct cf_iobuf cfFILE;
#define cf_IOFBF 00000
#define cf_IOREAD 00001
#define cf_IOWRT 00002
#define cf_IONBF 00004
#define cf_IOMYBUF 00010
#define cf_IOEOF 00020
#define cf_IOERR 00040
#define cf_IOSTRG 00100
#define cf_IOLBF 00200
#define cf_IORW 00400
#define cf_IOAPPEND 01000
#define cf_IOTEXT 02000 /*